package practice;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class _选靓号_ {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input1 = sc.nextLine();
        char[] input2 = sc.nextLine().toCharArray();
        String[] arr = input1.split(" ");
        int N = Integer.valueOf(arr[0]);
        int K = Integer.valueOf(arr[1]);
        int[] H = new int[N];
        int[] res = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.valueOf(input2[i])-48;
        }
        System.out.println(N+"," + K);
        int cost = 9*K;
        int flag = H[0];
        for (int i = 0; i < H.length; i++) {
            int[] temp = new int[N];
            int[] abstemp = new int[N];
            for (int j = 0; j < H.length; j++) {
                temp[j] = H[j] - H[i];
                if (temp[j] > 0) abstemp[j] = temp[j];
                else abstemp[j] = -temp[j];
            }
            Arrays.sort(abstemp);
            int[] now = Arrays.copyOfRange(abstemp,0,K);
            int nowcost = 0;
            for (int num:
                 now) {
                nowcost += num;
            }
            int numfu = numin(temp,now);
            int tempK = K;
            if (nowcost < cost || (nowcost == cost && H[i] < flag)){
                flag = H[i];
                cost = nowcost;
                for (int j = 0; j < temp.length; j++) {
                    boolean f = judgein(now,abstemp[j]);
                    if (numfu > 0 && tempK > 0 && f && temp[j] < 0) {
                        res[j] = H[j];
                        tempK--;
                        numfu--;
                    }
                }
                for (int j = 0; j < temp.length; j++) {
                    boolean f2 = judgein(now,temp[j]);
                    if ((tempK > 0) && f2) {
                        res[j] = H[i];
                        tempK--;
                    }else {
                        res[j] = H[j];
                    }
                }
            }
        }
        System.out.println(cost);
        for (int num :
                res) {
            System.out.print(num);
        }

    }

    public static int count_(int[] arr){
        int res = 0;
        for (int num :
                arr) {
            if (num < 0) res++;
        }
        return res;
    }

    public static boolean judgein(int[] arr,int num) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num) return true;
        }
        return false;
    }

    public static int numin(int[] temp,int[] now) {
        int res = 0;
        int[] now1 = Arrays.copyOf(now,now.length);
        for (int i = 0; i < temp.length; i++) {
            for (int j = 0; j < now1.length; j++) {
                if (now1[j] == -temp[i] && temp[i] < 0){
                    res++;
                    now1[j] = 0 - now1[j];
                }
            }
        }
        return res;
    }


}
